package com.aaa.javaweb.dao.impl;

import com.aaa.javaweb.dao.YDDao;
import com.aaa.javaweb.until.JDBCUntil;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class YDDaoImpl implements YDDao {
    @Override
    public List<Map> selAll(String format) {
        String sql ="SELECT t_order.id,t_order.`name`,t_order.tel,t_type.tname,t_order.count,t_order.rzdate,t_order.leavedate,t_type.yj from t_order JOIN t_type ON t_order.roomtype=t_type.id where t_order.`status`=0 and t_order.rzdate=?";
        return JDBCUntil.selectMap(sql,format);
    }

    @Override
    public List<Map> selectxfrz(String format) {
        //查询今天退房的顾客
        String sql="SELECT * from t_ruzhudetail LEFT JOIN t_order ON t_ruzhudetail.orderid=t_order.id LEFT JOIN t_xvfangjilu ON t_ruzhudetail.id=t_xvfangjilu.ruzhuid where t_order.`status`=1 and ISNULL(endtime) and t_order.leavedate=?";
        return JDBCUntil.selectMap(sql,format);
    }

    @Override
    public List<Map> selectxfrzs(String format) {
        String sql="SELECT * from t_ruzhudetail LEFT JOIN t_order ON t_ruzhudetail.orderid=t_order.id LEFT JOIN t_xvfangjilu ON t_ruzhudetail.id=t_xvfangjilu.ruzhuid where t_order.`status`=1 and not ISNULL(endtime) and t_xvfangjilu.endtime=?";
        return JDBCUntil.selectMap(sql,format);
    }


}
